package mrusanov.staff

import java.util.Date
import mrusanov.player.Talent
import mrusanov.bonus.ConflictResolveBonus
import mrusanov.buildings.PsychologistRoom
import mrusanov.team.Club

class Psychologist(name: String, birthDay: Date, exp: Int, talent: Talent) extends ClubEmployee(name, birthDay, exp, talent) {
	def conflictResolveBonus(room: PsychologistRoom) = ConflictResolveBonus(this, room.usageLevel)
	override def isClubInfrastructureGoodEnough(club: Club): Boolean = {
		val bonusWithCurrentLevel = ConflictResolveBonus(this, club.buildings.psychologistRoom.buildingLevel)
		val bonusWithNextLevel = ConflictResolveBonus(this, club.buildings.psychologistRoom.buildingLevel + 1)
		// if bonuses are the same this means that club facility is good enough
		bonusWithCurrentLevel == bonusWithNextLevel
	}

	override def addToClubStaff(club: Club) {
		require(canBeAddedToClubStaff(club))
		club.clubStaff.psychologist = Some(this)
	}

	override def canBeAddedToClubStaff(club: Club) = club.clubStaff.psychologist.isEmpty
}
